import React from 'react'
import { Button, Form, Col, Row, Input } from 'antd'

/**
 * @description: 生产计划列表搜索
 * @author: xiaoxujs
 * @updata: xiaoxujs（20210729）创建
 */

const SelectModule = ({listFun, setSelectData}) => {
    const [form] = Form.useForm()
    const {resetFields, validateFields} = form

    const handleReset = () => {
        listFun()
        resetFields()
    }
    const onFinish = () => {
        validateFields().then(values => {
            setSelectData(values)
            const parames = {
                currentPage: 1,
                size: 10,
                ...values
            }
            listFun(parames)
        })
    }

    return <Form
        {...layout}
        name="basic"
        initialValues={{ remember: true }}
        onFinish={onFinish}
        form={form}
    >
        <Row>
            <Col span={8}>
                <Form.Item label="客户名称" placeholder="请输入客户名称" name="clientName">
                    <Input />
                </Form.Item>
            </Col>
            <Col span={8}>
            </Col>
        </Row>
        <Row>
            <Col span={24}>
                <Form.Item {...tailLayout}>
                    <Button onClick={handleReset}>重置</Button>
                    <Button type="primary" htmlType="submit">
                        确定
                    </Button>
                </Form.Item>
            </Col>
        </Row>
    </Form>
}

const layout = {
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
};

const tailLayout = {
    wrapperCol: { offset: 0, span: 24 },
};

export default SelectModule